package com.iakuil.app.domain.dto.cmd;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Past;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 书籍实体编辑参数
 *
 * @author Kai
 * @date 2023-11-28
 **/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class BookEdit implements Serializable {

    @Schema(description = "ID")
    @NotNull(message = "ID不能为空")
    private Long id;

    @Schema(description = "标题")
    @Size(max = 50, message = "书籍标题长度不能超过{max}")
    private String title;

    @Schema(description = "作者ID")
    private Long[] authorIds;

    @Schema(description = "出版社ID")
    private Long pressId;

    @Schema(description = "ISBN")
    private String isbn;

    @Schema(description = "价格")
    @Digits(integer = 8, fraction = 6, message = "价格范围错误，只允许{integer}位整数和{fraction}位小数")
    private BigDecimal price;

    @Schema(description = "出版日期")
    @Past(message = "出版日期错误")
    private Date publishDate;

    @Schema(description = "简介")
    @Size(max = 4000, message = "书籍简介长度不能超过{max}")
    private String introduction;
}
